# list
# Basically, Python lists are very flexible and can hold completely heterogeneous, arbitrary data, 
# and they can be appended to very efficiently, in amortized constant time. 
# If you need to shrink and grow your list time-efficiently and without hassle, they are the way to go. 
# But they use a lot more space than C arrays,
# in part because each item in the list requires the construction of an individual Python object, 
# even for data that could be represented with simple C types (e.g. float or uint64_t).
# see https://stackoverflow.com/questions/176011/python-list-vs-array-when-to-use

# 1D list
# initialize
A = [0] * 10 # list with length 10, each element in the list is 0
A = [] # an empty list
A = [_ for _ in range(4)] # [0, 1, 2, 3]
print(A)

# compare with vector
A.append(1) # append -> push_back 
A.pop()     # pop -> pop_back
len(A)      # len -> length
max(A)      # max -> *max_elment; min -> *min_element; Note: make sure A is not empty
A.remove(9) # remove the first 9 in A, make sure x in list. I don't use
A.count(1)  # count how many 1s in A
A.insert(3, 100) # insert 100 into A[3] [1, 2, 3, 4] -> [1, 2, 3, 100, 4]
A.extend([1, 2, 3]) #  concat two list? maybe you can use `+`
A.copy()    # copy of A
A.clear()   # clear the list

A[-1]       # the last element of the list -> back in STL's vector
A[1:3]      # returns [A[1], A[2]]
A[:3]       # returns [A[0], A[1], A[2]]
A[1:]       # returns [A[1], A[2], ..., A[-1]] 

# other choices
# import array
# array.array